﻿using Architecture.Api.Application.Command.MenuCommand;
using Architecture.Domain.Dto;
using Architecture.Service;
using MediatR;

namespace Architecture.Api.Application.CommandHandlers.MenuHandler
{
    public class MenuShowCommandHandler : IRequestHandler<MenuShowCommand, PageListDto<MenuDto>>
    {
        protected readonly IMenuService _menuService;

        public MenuShowCommandHandler(IMenuService menuService)
        {
            _menuService = menuService;
        }

        public async Task<PageListDto<MenuDto>> Handle(MenuShowCommand request, CancellationToken cancellationToken)
        {
            return await _menuService.GetAllAsync(request.pageIndex,request.pageSize,request.menuName);
        }
    }
}
